package cn.zhangtiancinb.simple_demo.http.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

/**
 * 自动消费服务
 *
 * @author 张天赐
 */
@Slf4j
@Component
@RabbitListener(queues = "${topic.auto_consume:AUTO_CONSUME_TOPIC}")
public class AutoConsumeService {

    /**
     * 消息消费回调
     *
     * @param message 消息内容
     */
    @RabbitHandler(isDefault = true)
    public void run(@Payload String message) {
        log.info("consume:{}", message);
    }
}
